package com.tf_cut.admin.util;

import java.io.InputStream;
import java.util.List;

import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;

public class ExcelUtil {

    /**
     *  	导入Excel
     * 
     * @param inputstream Excel数据流
     * @param clazz 注解的实体类
     * @return 导入的数据
     */
    public static <T> List<T> importExcel(InputStream inputstream, Class<T> clazz) {
        ImportParams params = new ImportParams();
        params.setTitleRows(0);
        params.setNeedSave(false);
        try {
            return ExcelImportUtil.importExcel(inputstream, clazz, params);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

}